import http from 'utilMethods/http'

const request = 'http://report.wsn2019.club/report'

const report = {
  postReport(params) {
    return http.post(`${request}`, params)
  },

  postUpdateReport(params) {
    return http.post(`${request}/update`, params)
  },

  deleteReport(reportId) {
    return http.delete(`${request}/` + reportId)
  },

  getQueryLateUser(params) {
    return http.get(`${request}/late`, params)
  },

  getProDetail(params) {
    return http.get(`${request}/prodetail`, params)
  },

  getReportProgress() {
    return http.get(`${request}/progress`)
  },

  getProgressString(userId) {
    return http.get(`${request}/progress/special/` + userId)
  },

  // 最近一个月的日报
  getRecentReport() {
    return http.get(`${request}/recent`)
  },

  //  导师端-按群号+时间段查询日报
  getReportsByGroupId(params) {
    return http.get(`${request}/group`, params)
  },

  getBossTags() {
    return http.get(`${request}/tags`)
  },

  //  导师端-按学生+时间段查询日报
  getReportsByUserId(params) {
    return http.get(`${request}/student`, params)
  },
  // 导师&学生端-按日期+群号+标签+用户ID查询日报
  getQueryReports(params) {
    return http.get(`${request}/query/report`, params)
  },

  //查询待办事项相关日报条目
  getBacklogTimeline(params) {
    return http.get(`${request}/backlog`, params)
  },

  //昨天没填日报的名单
  getYesterdayUnfinished(groupId) {
    return http.get(`${request}/unfinished/${groupId}`)
  },

  // 获取暂存在服务器上的日报
  getTempReportFromServer() {
    return http.get(`${request}/recover`);
  },

  // 提交暂存的日报
  postTempReportToServer(dayReport) {
    return http.post(`${request}/storage`, dayReport);
  },

  // 获得某人最新的日报
  getUserLatestRepo(userId) {
    return http.get(`${request}/last/`+userId);
  },

  // 查看某群所有成员最新的日报，今日未汇报的在前面，其他人按照日报填写时间由近到远排序
  getLatestRepoList(groupId) {
    return http.get(`${request}/groupLast/`+groupId);
  },

  //查看某成员是否还有休息次数
  getIsHaveRestTime(){
    return http.get(`${request}/rest`);
  }
}

export default report
